TestCase
(
	'org.puremvc.js.core.ModelTest'
,	{
		testGetInstance: function ()
		{
			var model= Model.getInstance();
			assertNotNull('Model#getInstance returned an object', model);
			assertInstanceOf('Model#getInstance returned an instance of Model', Model, model);
		}
		
	,	testRegisterAndRetrieveProxy: function ()
		{
			var model= Model.getInstance()
			,	proxyName= 'colors'
			,	proxyData= ['red', 'green', 'blue']
			,	newProxy= new Proxy(proxyName, proxyData)
			,	retrievedProxy= null
			,	retrievedData= null
			
			
			model.registerProxy(newProxy);
			retrievedProxy= model.retrieveProxy(proxyName)
			retrievedData= retrievedProxy.getData()
			
			assertSame('The retrieved proxy retrieved its data correctlys', proxyData, retrievedData);
		}
		
	,	testRegisterAndRemoveProxy: function ()
		{
			var model= Model.getInstance()
			,	proxyName= 'sizes'
			,	proxyData= ['7', '13', '21']
			,	newProxy= new Proxy(proxyName, proxyData)
			,	removedProxy= null;
			
			model.registerProxy(newProxy);
			removedProxy= model.removeProxy(proxyName);
			
			assertSame('The removed proxy was returned successfully', newProxy, removedProxy);
			
			newProxy= model.retrieveProxy(proxyName);
			assertNull('Expecting proxy is null', newProxy);
		}
		
	,	testHasProxy: function ()
		{
			var model= Model.getInstance()
			,	proxyName= 'aces'
			,	proxyData= ['clubs', 'spades', 'hearts', 'diamonds']
			,	newProxy= new Proxy(proxyName, proxyData);
			
			
			model.registerProxy(newProxy);
			
			assertTrue('The model has the proxy', model.hasProxy(proxyName));
			
			model.removeProxy(proxyName);
			
			assertFalse('The model no longer has the proxy', model.hasProxy(proxyName));
		}
		
	,	testOnRegisterAndOnRemove: function ()
		{
			
			var model= Model.getInstance()
			,	proxy= new ModelTestProxy
			
			model.registerProxy(proxy);
			assertSame('The Proxys #onRegister method was called', ModelTestProxy.ON_REGISTER_CALLED, proxy.getData());
			
			model.removeProxy(ModelTestProxy.NAME);
			
			assertSame('The Proxys #onRemove method was called',  ModelTestProxy.ON_REMOVE_CALLED, proxy.getData());
		}
	}
)
